package org.csmz.class2333;

import java.util.Scanner;

public class Example04 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入第一个数：");
        int number1 = scan.nextInt();
        System.out.println("请输入第二个数：");
        int number2 = scan.nextInt();
        int min = (number1 <= number2)?number1:number2;
        for(int i = min;i>1;i--){
            if(number1 % i == 0 && number2 % i == 0){
                System.out.println("最大公约数为：" +i);
                break;
            }
        }
        int max = (number1 >= number2)? number1:number2;
        for (int i = max;i <= number1 *number2;i++){
            if(i % number1 == 0 && number2 % i == 0){
                System.out.println("最小公倍数为：" +i);
                break;
            }
        }
    }
}